package com.ceres.farm.dao;

import com.ceres.farm.pojo.CustFarmland;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import org.springframework.web.bind.annotation.PathVariable;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;

@Repository
public interface CustFarmlandMapper extends Mapper<CustFarmland> {
    /**
     * 根据条件进行查询
     * @param keyword
     * @return
     */
    @Select("<script>select * from t_cust_farmland <if test=\"keyword!=null and keyword!=''\">where size=#{keyword} or shape=#{keyword} or code=#{keyword} or status=#{keyword} </if></script>")
    List<CustFarmland> findByKeyWord(@Param("keyword") String keyword);

    //根据大田id查询所属片区ID
    @Select("select aid FROM t_cust_farmland WHERE id =#{id}")
    Integer findIdById(Integer id);
}
